<?php
require_once("functions.php");

function GetUsers(){
	$conn = GetConnection();
	return $conn->query('SELECT * FROM 2012UG_Users');
}

function GetUser($id){
	$conn = GetConnection();
	$results = $conn->query("SELECT * FROM 2012UG_Users WHERE id=$id");
	$row = $results->fetch_assoc();
	$conn->close();
	return $row;
}

function SaveUser($row){
	$conn = GetConnection();
	$results = $conn->query("UPDATE * FROM 2012UG_Users SET FirstName='$row[firstName]',LastName='$row[lastName]',created_at='$row[created_at],updated_at='$row[updated_at] WHERE id='$row[id]'");
	$error = $conn->$error;
	$conn->close();
	
	return $error == '' ? TRUE : array('SQL Error'=>$error);
}